package edu.gatech.TNE.wonderLab7000.M9;

import java.sql.SQLException;

import edu.gatech.TNE.wonderLab7000.person.person;

import junit.framework.TestCase;

public class M9Test extends TestCase
{
	
	public void testMattDye() throws SQLException
	{
		Sport soccer = new Sport(15,"Soccer");
		ADEmployee employee = new ADEmployee();
		assertTrue(soccer.getName()!=null);
		String[][] leagues = employee.getLeagues();
		for(String[] arr : leagues)
		{
			for(String str : arr)
			{
				if(str!=null)
				assertFalse(str.equalsIgnoreCase("Intramurals"));
			}
		}
		assertTrue(employee.createLeague("Intramurals", soccer));
		
	}
	public void testChadSheurpukdi() throws SQLException {
		
		TeamCaptain captain = new TeamCaptain("Captain Planet", "TESTLEAGUE");
		assertFalse(captain.createTeam("existingTeam", 20));
		assertTrue(captain.createTeam("newTeam", 20));
		assertTrue(captain.deleteTeam("newTeam"));
		assertFalse(captain.deleteTeam("invisibleTeam"));
		
	}
	

	public void testJustinHand()
	{
			Validator validator = new Validator();		
			person test;
			try {
				test = validator.validate("", "");			
			assertEquals(test.getAccessLevel(), 0);
			test = validator.validate(null, null);
			assertEquals(test.getAccessLevel(), 0);
			test = validator.validate("labAdmin", "password");
			assertEquals(3, test.getAccessLevel());
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}
	public void testDrop() throws SQLException
	{
		ADEmployee employee = new ADEmployee();
		assertTrue(employee.dropTable("Intramurals"));
		assertTrue(employee.deleteFrom("Intramurals"));
	}

}
